<template>
  <!-- 编辑评语 -->
  <el-dialog
    title="预览报告"
    class="gl_dialog_TitleLine gl_dl_footer card"
    :visible.sync="dialogEditVisible"
    :close-on-click-modal="false"
    width="418px"
    top="25vh"
  >
    <div v-if="dialogEditVisible" class="inphone">
      <iframe width="375px" height="667px" :src="url" frameborder="0" />
    </div>
  </el-dialog>
</template>

<script>
import { mapState, mapActions } from 'vuex';
export default {
  data() {
    return {
      dialogEditVisible: false,
      msgId: '',
      studentId: '',
      registerId: '',
      url: ''
    };
  },
  computed: {
    ...mapState({
      dict: state => state.dict.dict,
      user: state => state.user
    })
  },
  watch: {
    dialogEditVisible: {
      deep: true,
      handler(val) {
        if (val) {
          this.getStaticUrl();
        }
      }
    }
  },
  created() {
    console.log(this.msgId);
    this.getDict();
  },
  methods: {
    ...mapActions({ getDict: 'dict/getDict' }),
    getStaticUrl() {
      console.log(window.location);
      const _tenantId = this.user.tenantId || '';
      this.url = window.location.origin + '/mycenter.html#/message/h5/studentReport/' + this.msgId + '?token=' + this.user.token + '&tokentype=Bearer' + '&tenantId=' + _tenantId + '&studentId=' + this.studentId + '&registerId=' + this.registerId;
    }
  }
};
</script>

<style lang="scss" scoped>
.inphone{
 width: 375px;
 height: 667px;
}
</style>
